<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
    <style>
        .first{
            width: 100px;
            height: 100px;
            background-color: pink;
        }
        .second{
            width: 200px;
            height: 200px;
            background-color: red;
        }
        .thred{
            width: 300px;
            height: 300px;
            background-color: yellow;
        }
        .active{
            size: 20;
            color: pink;
        }
    </style>
</head>
<body>
    <div id="app">
        <!-- class强制绑定的值为一个对象，对象的key就是类型，key对应的value值为true 开启 -->
       <div :class="className"></div>
       <!-- 拥有active属性 -->
       <div :class="isActive?'active':''">active</div>
       <div :class ="{active:isActive}">1111</div>
    </div>
    <script>
        const vm = new Vue({
            el:"#app",
            data(){
                return{
                    //给元素绑定一个class属性，通过改变data中class中的数据来控制视图的更新
                    className:{
                        first:false,
                        second:true,
                        thred:false,
                    },
                    isActive:true,
                };
            },
        });
    </script>
</body>
</html>